#!/bin/sh
#
# Author ： hbaolong@vip.qq.com
#
# Function : 显示我的英语字典的现状。
#
#
#

if [ $# -ne 0 ]; then
	echo "Usage: 不需要参数."
	exit
fi

localdir="/Users/hbaolong/workshop/gitee/3place/ENMYDICT/"

dictfile="myendict.md"

cd $localdir

wordsindict=`grep "^#### " $localdir$dictfile|wc|awk '{print $1}'`

echo "字典目前有" $wordsindict "单词"

ps -ef |grep getdict|grep local >/dev/null

if [ $? -eq 0 ]; then 
	bookname=`ps -ef |grep getdict|grep local|awk '{print $NF}'|sed -e "s/_.*//g"`
fi

if [ -e $localdir"tmp.md" ]; then 

	cur_book_dict=`grep "^#### " dict.md |wc| awk '{print $1}'`

	cur_book_example=`wc forexample.md | awk '{print $1}'`

	cur_book_dict_all=`wc tmp.md | awk '{print $1}'`

#	bookname=`grep "^% " dict.md |awk '{print $2}'`

	echo "正在生成" $bookname "书籍字典"

	echo "已经生成" $cur_book_dict "/" $cur_book_dict_all "个单词"

	echo "使用" $cur_book_example "例句"

	reuse=`echo "scale=2; $cur_book_example/$cur_book_dict" | bc`

	reuse=`echo "100 * (1 - $reuse)" | bc`

	echo "例句复用率："$reuse"%"

else
	echo "没有正在生成的书籍字典"
fi

